package com.sinosoft.emplmis.labor.manager.impl;

import java.util.List;

import org.apache.log4j.Logger;

import com.github.pagehelper.PageHelper;
import com.sinosoft.emplmis.labor.dao.LaborInfoEntityMapper;
import com.sinosoft.emplmis.labor.entity.LaborInfoEntity;
import com.sinosoft.emplmis.labor.manager.LaborInfoManager;
import com.sinosoft.emplmis.labor.web.dto.LaborSearchData;

public class LaborInfoManagerImpl implements LaborInfoManager {
	/**
	 * 获取劳动力信息mapper
	 */
	private LaborInfoEntityMapper laborInfoEntityMapper;

	public LaborInfoEntityMapper getLaborInfoEntityMapper() {
		return laborInfoEntityMapper;
	}

	public void setLaborInfoEntityMapper(
			LaborInfoEntityMapper laborInfoEntityMapper) {
		this.laborInfoEntityMapper = laborInfoEntityMapper;
	}
	
	@Override
	public int insert(LaborInfoEntity record) {
		 Logger.getRootLogger().info("添加劳动力信息");
		 return laborInfoEntityMapper.insert(record);
	}

	@Override
	public int deleteByPrimaryKey(String laborinfoId) {
		Logger.getRootLogger().info("根据主键删除劳动力信息");
		return laborInfoEntityMapper.deleteByPrimaryKey(laborinfoId);
	}

	@Override
	public List<LaborInfoEntity> selectAll(LaborSearchData data) {
		Logger.getRootLogger().info("获取劳动力信息");
		PageHelper.startPage(data.getPage(), data.getRows());
	    return laborInfoEntityMapper.selectAll(data);
	}
	
	@Override
	public List<LaborInfoEntity> selectLoseContact(LaborSearchData data) {
		Logger.getRootLogger().info("获取失联人员信息");
		PageHelper.startPage(data.getPage(), data.getRows());
		return laborInfoEntityMapper.selectLoseContact(data);
	}
	
	@Override
	public LaborInfoEntity selectByPrimaryKey(String laborinfoId) {
		 Logger.getRootLogger().info("根据主键获取劳动力信息");
		 return laborInfoEntityMapper.selectByPrimaryKey(laborinfoId);
	}

	@Override
	public int updateLaborInfo(LaborInfoEntity record) {
		Logger.getRootLogger().info("根据主键修改劳动力基本信息");
		return laborInfoEntityMapper.updateLaborInfo(record);
	}
	
	@Override
	public int updateLoseTouch(LaborInfoEntity record) {
		Logger.getRootLogger().info("根据主键修改失联人员信息");
		return laborInfoEntityMapper.updateLoseTouch(record);
	}
	
	@Override
	public int count(LaborSearchData data){
		 Logger.getRootLogger().info("获取劳动力信息总条目数");
		 return laborInfoEntityMapper.count(data);
	}

	@Override
	public int countlose(LaborSearchData data) {
		 Logger.getRootLogger().info("获取失联人员总条目数");
		 return laborInfoEntityMapper.countlose(data);
	}

}
